home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_01 / yuen / cthread.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-10  |  625 b   |  36 lines

  1. #ifndef    __CTHREAD
  2. #define __CTHREAD
  3.  
  4. #include <setjmp.h>
  5.  
  6. const int THD_MAX_STACK = 0x4000;    /* maximum stack size allowed */
  7.  
  8. typedef void (* THDFN)(void);
  9.  
  10. typedef struct thd_type {
  11.   jmp_buf Context;        /* context of thread */
  12.   int TotalLen;            /* total length of structure */
  13.   int Overflowed;        /* overflow guard */
  14.   int Stack[THD_MAX_STACK];    /* stack of thread */
  15.   } THD, *THDPTR;
  16.  
  17.  
  18. class Cthread
  19. {
  20. private:
  21.  
  22.   THDPTR threadbody;
  23.   
  24.  
  25.   Cthread(THDFN func, int stacksize, int *frame, int framesize);
  26.  
  27.   void Transfer(Cthread& thread);
  28.   
  29.   ~Cthread(void); 
  30.  
  31.   friend Cschlr;
  32.  
  33. };
  34.  
  35. #endif
  36.